﻿<phone:PhoneApplicationPage 
    x:Class="CetWin.Views.WordDetailView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    xmlns:phoneExt="clr-namespace:Phone.Framework.Behaviors;assembly=Phone.Framework"
    xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
   
        <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot x:Name="pivot" Title="Translation"
                        SelectedIndex="{Binding SelectedPivotIndex,Mode=TwoWay,FallbackValue=-1}"
                        cal:Message.Attach="[Event SelectionChanged] = [Action ChangePivot($this.SelectedIndex)]"
                        >
            <!--Pivot item one-->
            <controls:PivotItem Header="local">
                <Grid Margin="12,0,12,0">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Border VerticalAlignment="Top"
                    Background="{StaticResource PhoneAccentBrush}">

                        <StackPanel Margin="10,0,0,6">
                        <TextBlock VerticalAlignment="Bottom"
                           Text="{Binding Path=SelectedWord.Name,Mode=TwoWay}"
                           FontFamily="{StaticResource PhoneFontFamilyNormal}"
                           FontSize="41"
                           Foreground="{StaticResource PhoneForegroundBrush}"
                           TextWrapping="NoWrap"
                           LineStackingStrategy="BlockLineHeight"
                           LineHeight="39"></TextBlock>
                        <TextBlock Foreground="Silver" HorizontalAlignment="Left"  
                                    Text="{Binding Path=SelectedWord.Pron,Mode=TwoWay,StringFormat=[\{0\}]}"
                                    FontSize="{StaticResource PhoneFontSizeMediumLarge}"></TextBlock>
                        </StackPanel>
                       
                    </Border>
                    <Border Grid.Row="1"
                    Margin="0,12,0,0"
                    Background="{StaticResource PhoneDisabledBrush}">
                        <TextBlock VerticalAlignment="Bottom"
                           Margin="10,0,0,6"
                           Text="{Binding SelectedWord.Explain}"
                           FontFamily="{StaticResource PhoneFontFamilyNormal}"
                           FontSize="{StaticResource PhoneFontSizeMedium}"
                           Foreground="{StaticResource PhoneForegroundBrush}"
                           TextWrapping="Wrap"
                           LineStackingStrategy="BlockLineHeight"
                           LineHeight="39">
                        </TextBlock>
                    </Border>
                    <Border Grid.Row="2"
                            Visibility="{Binding SelectedWord.Category,Converter={StaticResource CollapsedWhenStringNullConverter}}"
                    Margin="0,12,0,0"
                    Background="{StaticResource PhoneDisabledBrush}">
                        <TextBlock VerticalAlignment="Bottom"
                           Margin="10,0,0,6"
                                   Text="{Binding SelectedWord.Category}"
                           FontFamily="{StaticResource PhoneFontFamilyNormal}"
                           FontSize="{StaticResource PhoneFontSizeMedium}"
                           Foreground="{StaticResource PhoneForegroundBrush}"
                           TextWrapping="Wrap"
                           LineStackingStrategy="BlockLineHeight"
                           LineHeight="39">
                        </TextBlock>
                    </Border>
                    <!--<ItemsControl Margin="7"
                          Grid.Row="3"
                          x:Name="images_Element">
                        <i:Interaction.Behaviors>
                            <phoneExt:NoItemsSourceTipBehavior />
                        </i:Interaction.Behaviors>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <toolkit:WrapPanel />
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Image Width="94"
                               Margin="5"
                               Height="94"
                               Stretch="None">
                                    <i:Interaction.Behaviors>
                                        <phoneExt:BingImageLoadBehavior Url="{Binding Thumbnail.Url}" />
                                    </i:Interaction.Behaviors>
                                </Image>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>-->
                </Grid>
            </controls:PivotItem>
            <!--Pivot item two-->
            <controls:PivotItem Header="internet">
                <Grid Margin="12,0,12,0">
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <ScrollViewer>
                        <phone:WebBrowser Background="Transparent" x:Name="browser_Element"
                                          Source="{Binding BrowserURL,Mode=TwoWay}" />
                    </ScrollViewer>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Header="image">
                <Grid Margin="12,0,12,0">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <ScrollViewer>
                        <ItemsControl Margin="7"
                                      ItemsSource="{Binding ImageResult}"
                                      x:Name="images_Element">
                            <i:Interaction.Behaviors>
                                <phoneExt:NoItemsSourceTipBehavior />
                            </i:Interaction.Behaviors>
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <toolkit:WrapPanel />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <Image Width="90"
                                           Margin="5"
                                           Height="90"
                                           Stretch="None">
                                        <i:Interaction.Behaviors>
                                            <phoneExt:BingImageLoadBehavior Url="{Binding Thumbnail.Url}" />
                                        </i:Interaction.Behaviors>
                                    </Image>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>

                        </ItemsControl>
                    </ScrollViewer>
                </Grid>
            </controls:PivotItem>
            <!--Pivot item three-->
            <!--<controls:PivotItem Header="Extension">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="200" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <TextBox TextWrapping="Wrap"
                             Text="{Binding Extesion.Comment,Mode=TwoWay}">
                        <i:Interaction.Behaviors>
                            <phoneExt:UpdateTextBindingOnPropertyChanged />
                        </i:Interaction.Behaviors>
                    </TextBox>
                    <Button Grid.Row="1"
                            Content="Update"
                            cal:Message.Attach="UpateExtesion" />
                </Grid>
            </controls:PivotItem>-->
        </controls:Pivot>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True"
                              IsMenuEnabled="True">
            <shell:ApplicationBar.Buttons>
                <!--<shell:ApplicationBarIconButton IconUri="Resources/Icons/voice.png" x:Name="aaa"
                                  Text="Voice" Click="AppBarButton_Click" />-->
                <!--<cal:AppBarButton IconUri="Resources/Icons/appbar.home.rest.png"
                                  Text="Home"
                                  Message="GoHome" />-->
                <cal:AppBarButton IconUri="Resources/Icons/appbar.mic.rest.png"
                                  Text="Record" Message="SpeakRecord"/>
                <cal:AppBarButton IconUri="Resources/Icons/voice.png"
                                  Text="Spell" Message="PlayVoice"/>
                <cal:AppBarButton IconUri="Resources/Icons/appbar.favs.addto.rest.png"
                                  Text="Add to Fav"
                                  Message="AddToHistory()" />
            </shell:ApplicationBar.Buttons>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    <i:Interaction.Behaviors>
        <phoneExt:ApplicationBarButtonIconSwitchBehavior 
            Text="Add to Fav" SwitchText="Remove Fav"
            IconUri="Resources/Icons/appbar.favs.remove.rest.png"
            CanSwitch="{Binding CanSwitchHistoryIcon,Mode=TwoWay}" />
        <phoneExt:MediaPlayBehavior />
        <!--<phoneExt:ApplicationBarSelectorBehavior Pivot="pivot">
            <phoneExt:ApplicationBarSelector>
                <phoneExt:ApplicationBarSelector.Buttons>
                    <shell:ApplicationBarIconButton Text="Text1"
                                                    IconUri="Resources/Icons/appbar.favs.remove.rest.png" />
                    <shell:ApplicationBarIconButton Text="Text2"
                                                    IconUri="Resources/Icons/appbar.favs.remove.rest.png" />
                </phoneExt:ApplicationBarSelector.Buttons>
            </phoneExt:ApplicationBarSelector>
       
        <phoneExt:ApplicationBarSelector>
            <phoneExt:ApplicationBarSelector.Buttons>
                    <shell:ApplicationBarIconButton Text="Text3"
                                                    IconUri="Resources/Icons/appbar.favs.remove.rest.png" />
                    <shell:ApplicationBarIconButton Text="Text4"
                                                    IconUri="Resources/Icons/appbar.favs.remove.rest.png" />
            </phoneExt:ApplicationBarSelector.Buttons>
        </phoneExt:ApplicationBarSelector>
        </phoneExt:ApplicationBarSelectorBehavior>-->
    </i:Interaction.Behaviors>
</phone:PhoneApplicationPage>
